<template>
	<view class="revenue-item" @tap="toDetail()">
		<view class="icon">
			<image class="image" :src="item.icon" v-if="item.icon"></image>
			<image class="image" src="@/static/images/news/income.png" v-else></image>
		</view>
		<view class="content">
			<view class="top">
				<text class="title">{{ item.title }}</text>
				<text class="date">{{ (item.createTime * 1000) | newsActivity}}</text>
			</view>
			<view class="center">{{ item.content }}</view>
			<view class="bottom">
				<text class="text">查看详情</text>
				<text class="iconfont icon-xiayiye"></text>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	props: {
		item: {
			type: Object,
			default: () => {
				return {};
			}
		}
	},

	methods: {
		toDetail() {
			if (this.item.type === 5) {
				// 跳转至首页
				uni.switchTab({
					url: '/pages/index/index'
				});
			} else if (this.item.type === 6) {
				// 跳转至积分明细页
				this.$Router.push('/pages/integral/details');
			} else if (this.item.type === 7) {
				// 跳转至提现记录页
				this.$Router.push('/pages/member/record');
			} else if (this.item.type === 8) {
				// 跳转至我的订单-已失效页
				this.$Router.push({
					path: '/pages/member/order',
					query: {
						type: 2
					}
				});
			} else if (this.item.type === 9) {
				// 跳转至我的订单-入账中页
				this.$Router.push({
					path: '/pages/member/order',
					query: {
						type: 0
					}
				});
			} else if (this.item.type === 10) {
				// 跳转至我的订单-全部页
				this.$Router.push('/pages/member/order');
			}
		}
	}
};
</script>
<style lang="scss" scoped>
	.revenue-item {
		border-bottom: 2rpx solid #EBEBEB;
		padding-bottom: 20rpx;
		margin-top: 20rpx;
		@include flexBox(space-between, flex-start);
		.icon {
			width: 72rpx;
			height: 72rpx;
			margin-right: 30rpx;
			.image {
				width: 100%;
				height: 100%;
			}
		}
		.content {
			flex: 1;
			overflow: auto;
			@include flexBox(space-between, null, column);
			.top {
				margin-bottom: 10rpx;
				@include flexBox(space-between, center);
				.title {
					font-size: 30rpx;
					color: #171717;
					flex: 1;
					overflow: auto;
					@include ellipsis(1);
				}
				.date {
					font-size: 24rpx;
					color: #8F8F8F;
					margin-left: 20rpx;
				}
			}
			.center {
				font-size: 28rpx;
				color: #8F8F8F;
				margin-bottom: 20rpx;
			}
			.bottom {
				color: #818181;
				@include flexBox(space-between, center);
				.iconfont {
					font-size: 28rpx;
				}
			}
		}
	}
</style>
